import request from "@/utils/request";
import type {
  LoginResponseModel,
  UserInfoResponseModel,
} from "./model/loginModel";

//使用枚举来包含所有的path
enum Api {
  Login = "/admin/acl/index/login",
  GetUserInfo = "/admin/acl/index/info",
  Logout = "/admin/acl/index/logout",
}

//登陆

export const loginApi = (username: string, password: string) => {
  return request.post<any, LoginResponseModel>(Api.Login, {
    username,
    password,
  });
};

//获取用户信息
export const getUserInfoApi = () => {
  return request.get<any, UserInfoResponseModel>(Api.GetUserInfo);
};

//退出登陆
export const logoutApi = () => {
  return request.post(Api.Logout);
};
